package cn.glinks.liuhe.api;

import cn.glinks.liuhe.BuildConfig;
import cn.glinks.liuhe.utils.ToastUtils;

/**
 * Des:ApiConstants
 *
 * @author MarsBlade of Cyh
 * @created 2017-03-13 18:31
 */
public class ApiConstants {

    /*--------------------------------------------------------------------------------
     *                          基本配置
     ---------------------------------------------------------------------------------*/
    public static final int HOST_TYPE_SUM = 1;
    public static final String LIUHE_HOST = BuildConfig.URL_SERVER;//服务器地址

    /*--------------------------------------------------------------------------------
     *                          错误响应Toast Message
     ---------------------------------------------------------------------------------*/
    public final static void showError(String reason) {
        // 获取验证码错误信息
        if (reason.equals("phoneNo must not be empty!")) {
            ToastUtils.showShort("手机号不能为空");
        } else if (reason.equals("the phoneNo has been registered!")) {
            ToastUtils.showShort("手机号已经被注册");
        } else if (reason.equals("smsCode has been sent!")) {
            ToastUtils.showShort("短信验证码已发送");
        } else if (reason.equals("1023")) {
            ToastUtils.showShort("短信发送次数超过30秒内上限");
        } else if (reason.equals("1025")) {
            ToastUtils.showShort("短信发送次数超过单日上限");
        } else if (reason.equals("request send sms error!")) {
            ToastUtils.showShort("后台请求短信平台错误");
        }
        // 注册错误信息
        else if (reason.equals("missing field!")) {
            ToastUtils.showShort("缺少参数");
        } else if (reason.equals("idNo is not right!")) {
            ToastUtils.showShort("身份证号不正确");
        } else if (reason.equals("emid is not in inner system!")) {
            ToastUtils.showShort("员工号不在内部系统中");
        } else if (reason.equals("smscode is invalid!")) {
            ToastUtils.showShort("短信验证码无效");
        } else if (reason.equals("smscode is not correct!")) {
            ToastUtils.showShort("短信验证码不正确");
        } else if (reason.equals("the phoneNo has been registered!")) {
            ToastUtils.showShort("手机号码已经被注册");
        } else if (reason.equals("request third party interface error!")) {
            ToastUtils.showShort("调用第三方接口错误");
        } else if (reason.equals("unhandled error!")) {
            ToastUtils.showShort("调用第三方接口未处理的错误");
        } else if (reason.equals("query db error!")) {
            ToastUtils.showShort("查询数据库出错");
        } else if (reason.equals("emid has been registered!")) {
            ToastUtils.showShort("员工号已注册");
        }
        // 登录
        else if (reason.equals("missing field!")) {
            ToastUtils.showShort("缺少参数");
        } else if (reason.equals("phoneNo and password must not be empty!")) {
            ToastUtils.showShort("电话号码或密码不能为空");
        } else if (reason.equals("request third party interface error!")) {
            ToastUtils.showShort("调用第三方接口错误");
        } else if (reason.equals("phoneNo or password is not correct!")) {
            ToastUtils.showShort("电话号码或密码不正确");
        } else if (reason.equals("query db error!")) {
            ToastUtils.showShort("查询数据库出错");
        }
        // 忘记密码
        else if (reason.equals("missing field!")) {
            ToastUtils.showShort("缺少参数");
        } else if (reason.equals("param must not be empty!")) {
            ToastUtils.showShort("参数不能为空");
        } else if (reason.equals("smscode is invalid!")) {
            ToastUtils.showShort("短信验证码无效");
        } else if (reason.equals("smscode is not correct!")) {
            ToastUtils.showShort("短信验证码不正确");
        } else if (reason.equals("request third party interface error!")) {
            ToastUtils.showShort("调用第三方接口错误");
        } else if (reason.equals("set new password failed!")) {
            ToastUtils.showShort("设置新密码失败");
        }
        // 获取测试时间状态
        else if (reason.equals("missing field!")) {
            ToastUtils.showShort("缺少参数");
        } else if (reason.equals("param must not be empty!")) {
            ToastUtils.showShort("参数不能为空");
        }
        // 获取试题
        else if (reason.equals("missing field!")) {
            ToastUtils.showShort("缺少参数");
        } else if (reason.equals("param must not be empty!")) {
            ToastUtils.showShort("参数不能为空");
        } else if (reason.equals("user is testing!")) {
            ToastUtils.showShort("用户正在测试中");
        } else if (reason.equals("invalid time!")) {
            ToastUtils.showShort("不在有效的测试时间内");
        }
        // 提交答题
        else if (reason.equals("missing field!")) {
            ToastUtils.showShort("缺少参数");
        } else if (reason.equals("param must not be empty!")) {
            ToastUtils.showShort("参数不能为空");
        } else if (reason.equals("invalid answer!")) {
            ToastUtils.showShort("无效答题");
        } else if (reason.equals("query db error!")) {
            ToastUtils.showShort("查询数据库出错");
        } else if (reason.equals("result exists!")) {
            ToastUtils.showShort("结果已存在");
        } else if (reason.equals("has no question order!")) {
            ToastUtils.showShort("没有问题序列");
        }
        // 获取测评历史记录
        else if (reason.equals("query db error!")) {
            ToastUtils.showShort("查询数据库出错");
        }
        // 获取统计信息
        else if (reason.equals("query db error!")) {
            ToastUtils.showShort("查询数据库出错");
        }
        // 按名字搜索
        else if (reason.equals("query db error!")) {
            ToastUtils.showShort("查询数据库出错");
        }
        // 获取搜索的员工信息
        else if (reason.equals("query db error!")) {
            ToastUtils.showShort("查询数据库出错");
        }
        // 获取园区建议
        else if (reason.equals("query db error!")) {
            ToastUtils.showShort("查询数据库出错");
        }
        // 未知错误
        else {
            ToastUtils.showShort("未知错误:"+reason);
        }
    }
}
